Skip to content

fix(libSceNet): sceNetEpollWait takes 2 as the OUT event - #4611

Merged
adriadam10 merged 4 commits into
boykopovar:mainfrom
EagleBearerYS:fix/libscenet-epoll-out
Oct 13, 2026
Merged

adriadam10 merged 4 commits into
boykopovar:mainfrom
EagleBearerYS:fix/libscenet-epoll-out

Conversation

@EagleBearerYS

@EagleBearerYS EagleBearerYS commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What

sceNetEpollWait used Linux's EPOLLOUT bit (4) when it polled and when it reported writability. The SCE value is 2 (shadPS4 net_types.h, KytyPS5 network.cpp, SharpProspero Socket.cs); IN (1), ERR (8) and HUP (0x10) already match. A socket registered for OUT was never polled for writability, so the wait ran out its timeout or blocked forever, and an IN|OUT registration never reported OUT:

Registration on a UDP socket main This branch
OUT (0x2), idle socket 0 events after the full 1 s timeout 1 event, events 0x2, at once
IN|OUT (0x3), data pending events 0x1 (OUT missing) events 0x3

Same kind of fix as #4110, which corrected the sceNetEpollControl operation numbers.

Tested

Windows 11 (10.0.26300), WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT), Release, -DBUILD_TESTING=ON, on main at 2a5eca1:

  • With main's Export.cpp, the new CheckEpollWritable in guest_sce_net aborts (exit 0xc0000409); guest_sce_net passes on main itself, IPv6 checks included, so the abort is the new check. With the change it passes, 20 runs in a row.
  • All 128 tests registered in core/libs/prx/libc/CMakeLists.txt and core/libs/prx/libkernel/CMakeLists.txt that build on Windows pass, and so do the network tests (guest_datagram_recv, guest_datagram_recvfrom, guest_datagram_sceNetRecv, guest_datagram_sceNetRecvfrom, guest_udp, guest_resolver, guest_posix_filesystem).

Linux (Ubuntu 24.04, GCC 13.3, Release), base 33ae282: the new CheckEpollWritable in guest_sce_net aborts on main at sceNetEpollWait(epoll, &ready, 1, 1000000) == 1 and passes with the change, 20/20; the libSceNet, libc and libkernel tests are unchanged. Again on WSL2 (Ubuntu 24.04, GCC 13.3.0, Release with CI's configure flags), merged into main at c952c2b, IPv6 checks included: it aborts with main's Export.cpp and passes with the change, 20 runs in a row.

tools/check_conventions.py --base origin/main passes.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes

sceNetEpollWait used Linux's EPOLLOUT bit (4) for writability. The SCE
value is 2 (shadPS4 net_types.h ORBIS_NET_EPOLLOUT, KytyPS5 network.cpp
EPOLL_OUT, SharpProspero Socket.cs EpollOut); IN (1), ERR (8) and HUP
(0x10) already match. A socket registered for OUT was never polled for
writability, so the wait ran out its timeout or blocked forever, and an
IN|OUT registration never reported OUT.
@github-actions github-actions Bot added the prx label Oct 12, 2026
boykopovar#4673 adds a test after CheckEmptyEpoll and its call after CheckEmptyEpoll(), so placing the new check there made the two pull requests conflict.
boykopovar#4785 adds its netstat checks before CheckPoolStats, so defining CheckEpollWritable there made the two pull requests conflict.
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked sceNetEpollWait's four OUT sites against shadPS4's ORBIS_NET_EPOLLOUT = 0x2; CheckEpollWritable fails with main's Export.cpp and passes with the change, and the scoped ctest (29 tests) is green. Merging.

@adriadam10
adriadam10 merged commit 9d0a41d into boykopovar:main Oct 13, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants